package net.jescort.lucene;


import net.gelif.kernel.core.exception.SearchException;
import net.jescort.domain.forum.Post;
import net.jescort.domain.forum.Topic;
import net.jescort.lucene.runnable.IndexRunnable;

/**
 * Created by IntelliJ IDEA.
 * User: admin@gelif.net
 * Date: 11-8-25
 * Time: 下午3:18
 */
public interface IndexManager
{
    /** Does index need to be rebuild */
    public abstract boolean isInconsistentAtStartup();

    /** Remove entry from index, returns immediately and operates in background */
    public void removePostIndexOperation(Post post) throws SearchException;

    /** Add entry to index, returns immediately and operates in background */
    public void addPostIndexOperation(Post post) throws SearchException;

    /** R-index entry, returns immediately and operates in background */
    public void addPostReIndexOperation(Post post) throws SearchException;

    /** Execute operation immediately */
    public abstract void executeIndexOperationNow(final IndexRunnable runnable);

    /**
     * Release all resources associated with Roller session.
     */
    public abstract void release();


    /**
     * Initialize the search system.
     *
     * @throws SearchException If there is a problem during initialization.
     */
    public void initialize() throws SearchException;


    /** Shutdown to be called on application shutdown */
    public abstract void shutdown();

    public abstract void rebuildTopicIndex(Topic topic) throws SearchException;

    public abstract void rebuildTopicIndex() throws SearchException;
}
